<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="org.springframework.core.io.ClassPathResource"%>
<%@page import="org.springframework.beans.factory.xml.XmlBeanFactory"%>
<%@page import="com.zenika.zencontact.model.ContactDao"%>
<%@page import="java.util.List"%>
<%@page import="com.zenika.zencontact.model.Contact"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
out.println("Test");
try{

	ClassPathResource res= new ClassPathResource("applicationContext.xml");
	XmlBeanFactory factory= new XmlBeanFactory(res);
	ContactDao dao= (ContactDao)factory.getBean("jdbcContactDao");
	List<Contact> list=dao.find("");
	
	for(int i=0;i<list.size();i++){
		out.println("Name: "+list.get(i).getFirstName());
		
	}
	
}catch(Exception e){ e.printStackTrace();};
%>
</body>
</html>